<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 6/2/21
 * Time: 1:29 PM
 */

namespace app\api\model;


use think\model\concern\SoftDelete;

class User extends BaseModel
{
    use SoftDelete;

    public static function getOpenId($openid)
    {
        $user = self::where('openid','=',$openid)
            ->find();
        return $user;
    }

    public function getMemberEndTimeAttr($value)
    {
        if($value) {
            $time = time();
            if($value > $time) {
                return date('Y-m-d H:i:s',$value);
            } else {
                return '会员已过期';
            }
        } else {
            return '';
        }
    }
}